<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>学生管理</title>
</head>
<body>
<div th:include="/nav.html"></div>
<h1>学生管理</h1><hr>
<div style="display: flex">
    <div style="width: 75%">
        <table class="table" style="width: 90%">
            <tr>
                <td>学生ID</td>
                <td>学生名称</td>
                <td>手机号</td>
                <td>班级编号</td>
                <td>班级名称</td>
                <td>头像</td>
                <td>更改</td>
                <td>删除</td>
            </tr>
            <tr th:each="stu : ${users}">
                <td th:text="${stu.uid}"></td>
                <td th:text="${stu.uname}"></td>
                <td th:text="${stu.phone}"></td>
                <td th:text="${stu.clz.clzno}"></td>
                <td th:text="${stu.clz.clzname}"></td>
                <td style="width: 5vw;height: 5vw">
                    <img style="width: 100%;height: 100%" th:src="'/home/showImg/'+${stu.pic}">
                </td>
                <td><a th:href="'/adm/stu/go2update/'+${stu.uid}">更改</a></td>
                <td><a th:href="'/adm/stu/delete/'+${stu.uid}">删除</a></td>
            </tr>
        </table>
    </div>
    <div style="width: 20%">
        <p th:text="${function}"></p><hr>
        <form style="width: 90%" th:action="'/adm/stu/'+${method}" method="post" enctype="multipart/form-data">
            <input type="hidden" name="uid" th:value="${student.uid}">
            <p>姓名：<input type="text" name="uname" th:value="${student.uname}"></p>
            <p>电话：<input type="text" name="phone" th:value="${student.phone}"></p>
            <p>密码：<input type="text" name="pwd" th:value="${student.pwd}"></p>
            <p>
                <select name="clzno">
                    <option th:each="cl : ${clzs}"
                            th:selected="${student.clzno eq cl.clzno}"
                        th:text="${cl.clzname}"
                        th:value="${cl.clzno}">
                    </option>
                </select>
            </p>
            <input type="hidden" name="pic" th:value="${student.pic}">
            <p th:if="${method}=='update'" style="width: 30%;height: 30%">
                <img style="width: 100%;height: 100%"
                      th:src="'/home/showImg/'+${student.pic}">
            </p>
            <p>请选择图片：<input name="file" type="file" value=""> </p>
            <p><input type="submit"></p>
        </form>
    </div>
</div>
</body>
</html>